package p270jp.pxv.android.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import androidx.appcompat.app.AlertController;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import p270jp.pxv.android.R;
import p270jp.pxv.android.model.ProfileEditParameter;
import p307l9.EdgeTreatment;
import p314lg.ButtonSettingPublicityBinding;
import p547uh.DialogInterface$OnClickListenerC6461h5;

/* renamed from: jp.pxv.android.view.SettingPublicityButton */
/* loaded from: classes2.dex */
public class SettingPublicityButton extends LinearLayout implements View.OnClickListener {

    /* renamed from: c */
    public static final /* synthetic */ int f19692c;

    /* renamed from: a */
    public ButtonSettingPublicityBinding f19693a = (ButtonSettingPublicityBinding) DataBindingUtil.m11370c(LayoutInflater.from(getContext()), R.layout.button_setting_publicity, this, true);

    /* renamed from: b */
    public OnPublicityChangedListener f19694b;

    /* renamed from: jp.pxv.android.view.SettingPublicityButton$OnPublicityChangedListener */
    /* loaded from: classes2.dex */
    public interface OnPublicityChangedListener {
        void onPublicityChanged(ProfileEditParameter.Publicity publicity);
    }

    /* renamed from: jp.pxv.android.view.SettingPublicityButton$a */
    /* loaded from: classes2.dex */
    public static /* synthetic */ class C4392a {

        /* renamed from: a */
        public static final /* synthetic */ int[] f19695a;

        static {
            int[] iArr = new int[ProfileEditParameter.Publicity.values().length];
            f19695a = iArr;
            try {
                iArr[ProfileEditParameter.Publicity.PUBLIC.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f19695a[ProfileEditParameter.Publicity.PRIVATE.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f19695a[ProfileEditParameter.Publicity.MYPIXIV.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    public SettingPublicityButton(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        setOnClickListener(this);
    }

    @Override // android.view.View.OnClickListener
    public void onClick(View view) {
        CharSequence[] charSequenceArr = {getContext().getString(R.string.settings_profile_publicity_public), getContext().getString(R.string.settings_profile_publicity_private), getContext().getString(R.string.settings_profile_publicity_mypixiv)};
        AlertDialog.C0305a aVar = new AlertDialog.C0305a(getContext());
        DialogInterface$OnClickListenerC6461h5 h5Var = new DialogInterface$OnClickListenerC6461h5(this, 1);
        AlertController.C0299b bVar = aVar.f1085a;
        bVar.f1066p = charSequenceArr;
        bVar.f1068r = h5Var;
        aVar.m12005i();
    }

    public void setOnPublicityChangedListener(OnPublicityChangedListener onPublicityChangedListener) {
        this.f19694b = onPublicityChangedListener;
    }

    public void setPublicity(ProfileEditParameter.Publicity publicity) {
        EdgeTreatment.m3909i(publicity);
        int i = C4392a.f19695a[publicity.ordinal()];
        if (i == 1) {
            this.f19693a.f22239q.setText(getContext().getString(R.string.settings_profile_publicity_public));
        } else if (i == 2) {
            this.f19693a.f22239q.setText(getContext().getString(R.string.settings_profile_publicity_private));
        } else if (i == 3) {
            this.f19693a.f22239q.setText(getContext().getString(R.string.settings_profile_publicity_mypixiv));
        }
        OnPublicityChangedListener onPublicityChangedListener = this.f19694b;
        if (onPublicityChangedListener != null) {
            onPublicityChangedListener.onPublicityChanged(publicity);
        }
    }
}
